#ifndef PM_WORK_REQUEST_H_INCLUDED
#define PM_WORK_REQUEST_H_INCLUDED

#include "pm/dbobject.h"
#include "pm/criteria.h"
#include <wx/datetime.h>

namespace pm
{

class WorkRequest : public db::Table
{
public:
	db::text  name;
	db::real  amount;
	db::date  date;
	db::ID    id_project;

	static const wxString TABLE_NAME;
	
public:	
	WorkRequest();
    WorkRequest(wxSQLite3ResultSet& res);
	
	// DB
	virtual db::update_value_t prepare_insert(wxSQLite3Database& db);
	virtual db::update_value_t prepare_update(wxSQLite3Database& db);
};

/**
 * \class GetWorkRequestsByProject
 */
struct GetWorkRequestsByProject : public ICriteriaForEach<WorkRequest>
{
	db::ID id_project;
	
	GetWorkRequestsByProject(const db::ID& idProject);
	
	virtual wxSQLite3Statement prepare(wxSQLite3Database& db);
};

} // namespace pm

#endif // PM_WORK_REQUEST_H_INCLUDED
